package qqserver.service;

import java.util.concurrent.ConcurrentHashMap;

// 服务端线程管理类
public class ManageServerConnectThread {

//    用集合管理
        private static ConcurrentHashMap<String, ServerConnectThread> hsm = new ConcurrentHashMap<>(16);


        public static ConcurrentHashMap<String, ServerConnectThread> getHsm() {
                return hsm;
        }

        /**
         * 添加服务端线程到集合中
         * @param userid
         * @param sct
         */
        public static void addServerConnectThread(String userid, ServerConnectThread sct){
                hsm.put(userid,sct);
        }

        /**
         * 获取服务端对应的线程
         * @param userid
         * @return
         */
        public static ServerConnectThread getServerConnectThread(String userid){
                return hsm.get(userid);
        }


        /**
         * 将用户在服务端对应的线程从集合中移除
         * @param userid
         */
        public static void removeUserThread(String userid){
                hsm.remove(userid);
        }
}
